package java67_adv6;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Scanner;

public class GetNext {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		System.out.print("请输入出生日期：（月-日）");
		String bir = in.next();
		String[] ar = bir.split("-");
		int a = Integer.parseInt(ar[0]), b = Integer.parseInt(ar[1]);
		Calendar c1 = Calendar.getInstance();
		// c1.set(1896, 5, 7);
		long time1 = c1.getTimeInMillis();
		long time2 = 0;
		// >>>限制一下8年的 天数
		while (true) {
			if ((c1.get(Calendar.MONTH) + 1) == a && c1.get(Calendar.DAY_OF_MONTH) == b) {
				System.out.println(c1.getTime());
				time2 = c1.getTimeInMillis();
				break;
			}
			c1.add(Calendar.DATE, 1);
		}
		System.out.println("离下一个生日还有：" + (time2 - time1) / 1000 / 3600 / 24 + "天");
	}

}
